package com.osc.exam.controller;

import com.osc.exam.entity.Test;
import com.osc.exam.service.ITestInterface;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName TestController
 * @Description TODO
 **/
@RestController
public class TestController {

    @Autowired
    ITestInterface testInterface;

    @GetMapping("test")
    public String test(){
        return "exam test!";
    }

    @GetMapping("findAll")
    public Map<String, Object> findAll(){
        Map<String, Object> result = new HashMap<>();
        List<Test> testList = testInterface.findAll();
        result.put("code","200");
        result.put("message","success");
        result.put("result",testList);
        return result;
    }

}
